package com.itheima.heimatoutiaonews.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.heimatoutiaonews.domain.WmChannel;
import com.itheima.heimatoutiaonews.mapper.WmChannelMapper;
import com.itheima.heimatoutiaonews.service.WmChannelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class WmChannelServiceImpl extends SuperServiceImpl<WmChannelMapper, WmChannel> implements WmChannelService {

    @Autowired
    private WmChannelMapper wmChannelMapper;

    @Override
    public List<WmChannel> getChannels() {
        LambdaQueryWrapper<WmChannel> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(WmChannel::getStatus, 1);
        wrapper.orderByDesc(WmChannel::getOrd);
        return this.list(wrapper);
    }

}
